<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>layui</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="__LAYUI__/layui/css/layui.css" media="all" rel="stylesheet">
		<link href="__LAYUI__/adminui/dist/css/admin.css" media="all" rel="stylesheet">
	</head>
	<style>
		.wseditor {
			min-height: 380px;
			position: relative;
			padding: 16px;
			border: none;
			border-radius: 3px;
			background-color: #3f3f3f;
			color: #f8f8f2;
			font-family: Courier New;
		}
	</style>
	{include file="info" /}
	<body>
		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-body">
							<blockquote class="layui-elem-quote">
								<em>
									<span>注意：</span>1>这是一个演示代码
									<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									2>在下方进行编辑，运行将呈现对应结果
								</em>
							</blockquote>
							<div class="layui-form">
								<div class="layui-form-item">
<textarea class="layui-textarea wseditor" id="IDeditor">
// 在此处输入 layer 的任意代码

layer.open({
    type: 2, // iframe 层类型
    offset: "r",
    anim: "slideLeft", // 从右往左
    area: ["50%", "100%"],
    title: false,
    shade: 0.5, // 遮罩透明度
    shadeClose: true, // 点击遮罩区域，关闭弹层
    closeBtn: 0,
    content: "https://15799848.s21v.faiusr.com/58/ABUIABA6GAAgwtus4gUo1vjStgY.mp4",
    end: function(){
        top.notify.success("移除弹框", "topRight");
    }
});
</textarea>
								</div>
								<div>
									<button type="button" class="layui-btn" id="IDrun">运行</button>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
<script>
	layui.use(["layer", "jquery"], function() {
		var layer = layui.layer;
		var $ = layui.jquery;
		$("#IDrun").on("click", function() {
			var code = $("#IDeditor").val();
			try {
				new Function(code)();
			} catch (res) {
				top.notify.error(res.message, "topRight");
			}
		});

	});
</script>